#include<iostream>
#include<vector>
#include<algorithm>
#include <queue>
#include <functional>
using namespace std;
void display(vector<int>q) {
	for (int i = 0; i < q.size(); i++) {
		cout << q[i] << " ";
	}
	cout << endl;
}
int main(){
	vector<int> q;
	for (int i = 0; i < 10; i++) {
		q.push_back(i);
	}
	make_heap(q.begin(), q.end(),greater<int>());
	for (int i = 0; i < 9; i ++ ){
		pop_heap(q.begin(), q.end() - i, greater<int>());
		display(q);
	}
	return 0;
}